from PIL import Image as img
from PIL import ImageFilter as ift


class Filter:
    """
    过滤器基类
    """
    def __init__(self, image: img.Image, *params):
        self._image = image
        self._params = params

    def filter(self):
        pass


class FindEdges(Filter):
    """
    查找边缘
    """
    def filter(self):
        print(type(self._image))
        return self._image.filter(ift.FIND_EDGES)


class Sharpen(Filter):
    """
    锐化
    """
    def filter(self):
        return self._image.filter(ift.SHARPEN)


class Blur(Filter):
    """
    模糊
    """
    def filter(self):
        return self._image.filter(ift.BLUR)


class Resize(Filter):
    """
    调整尺寸
    """
    def filter(self):
        return self._image.resize(self._params[0][0])
